<%@ page import="java.io.File" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/8/18
  Time: 9:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>文件列表</title>
    <!-- 1. 引入bs的css样式-->
    <link rel="stylesheet" href="/webjars/bootstrap/3.4.1/css/bootstrap.min.css">
    <!-- 2. 引入jquery依赖-->
    <script src="/webjars/jquery/3.6.0/jquery.min.js"></script>
    <!--  3. 引入bs的js库-->
    <script src="/webjars/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
    <div class="container">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h3 class="panel-title">上传的文件列表</h3>
            </div>
            <div class="panel-body">
                <%
                    //1. 得到/upload的真实路径
                    String realPath = application.getRealPath("/upload");
                    //2. 得到此路径下的所有文件
                    File dirs = new File(realPath);
                    File[] files = dirs.listFiles();
                    for (File file : files) {
                        out.println("<li>");
                        out.println("<a href=''>" + file.getName() + "</a>");
                        out.println("</li>");
                    }
                %>
            </div>
        </div>
    </div>
</body>
</html>
